package com.im.service.controller;


import com.im.service.common.Result;
import com.im.service.common.UploadResult;
import com.im.service.service.MinioService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author liuzhiqiang
 */
@RestController
@RequestMapping("/minio")
@CrossOrigin
@Slf4j
@Api(tags = {"minio 相关接口"})
public class MinioController {

    @Autowired
    private MinioService minIoService;

    @ApiOperation(value = "上传")
    @PostMapping("/upload")
    public Result<UploadResult> upload(MultipartFile file) {
        UploadResult uploadResult = minIoService.upload(file);
        return Result.okData(uploadResult);
    }
}
